package br.com.linkideias.model.command.aluno;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;
import br.com.linkideias.model.bean.Aluno;
import br.com.linkideias.model.command.InterfaceCommand;
import br.com.linkideias.model.dao.HibernateDAO;
import br.com.linkideias.model.dao.InterfaceDAO;
import br.com.linkideias.util.HibernateUtil;

public class ConsultarAluno implements InterfaceCommand {

	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) {
		InterfaceDAO<Aluno> alunoDAO = new HibernateDAO<Aluno>(Aluno.class, (Session)request.getAttribute(HibernateUtil.HIBERNATE_SESSION));
		List<Aluno> alunos= alunoDAO.getBeans();
		request.setAttribute("alunos", alunos);
		return "consulta_aluno.jsp";
	}
}
